package Servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import Dao.*;
import Entity.*;

public class Opreate_Notes_Servlet extends HttpServlet {
	
	private Opreate_Notes_Dao notesdao = new Opreate_Notes_Dao();
	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=UTF-8");
		String method = request.getParameter("method");
		String path = "pages/Operate_Notes.jsp";
		boolean ac = false;
		if(method.equals("list")){
			List<Opreate_Notes_Entity>list = notesdao.select_pages();
			request.setAttribute("list", list);
		}
		if(ac){
			response.sendRedirect(path);
		}else{
			request.getRequestDispatcher(path).forward(request, response);
		}
	}

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		doGet(request,response);
	}

}
